<?php

namespace app\cps\controller;

use think\facade\Request;
use app\common\Error;
use app\common\Common;
use app\cps\service\LaunchService;

// 投放数据统计
class Launch extends Base
{
    private $service;

    public function __construct(LaunchService $service)
    {
        parent::__construct();
        $this->service = $service;
    }

    // 获取投放媒体
    public function getLaunchMedia()
    {
        $data = config('enum.launch_media');
        return Common::success($data);
    }

    // 渲染总览统计页
    public function overview()
    {
        return view();
    }

    // 获取总览统计数据
    public function overviewStatistics()
    {
        $data = $this->service->getOverviewDataStatistics($this->getUserInfo());
        return Common::success($data);
    }

    // 获取投放数据列表
    public function launchDataList()
    {
        $params = Request::param();

        $data = $this->service->getLaunchDataList($params, $this->getUserInfo());
        return Common::success($data);
    }

    // 渲染详情页
    public function info()
    {
        return view();
    }

    // 获取投放数据详情
    public function detail()
    {
        $params = Request::param();
        $data = $this->service->getLaunchDataDetail($params, $this->getUserInfo());
        return Common::success($data);
    }

    // 获取投放总览查看统计数据
    public function detailCount()
    {
        $params = Request::param();
        $data = $this->service->getLaunchDataDetailCount($params, $this->getUserInfo());
        return Common::success($data);
    }

    // 渲染抖音今日实时在投列表页
    public function realTime()
    {
        return view();
    }

    // 渲染抖音今日实时在投详情(每小时数据)
    public function realTimeInfo()
    {
        return view();
    }
    // 抖音今日实时在投
    public function investing()
    {
        $params = Request::param();

        // $data = $this->service->getInvestingData($params);
        $data = $this->service->getTiktokInvestingData($params, $this->getUserInfo());

        if (!empty($data['message'])) {
            return Common::fail($data['message']);
        }
        return Common::success($data);
    }

    // 渲染快手今日实时在投列表页
    public function kwaiRealTime()
    {
        return view();
    }

    // 快手今日实时在投
    public function kwaiInvesting()
    {
        $params = Request::param();
        $data = $this->service->getKuaiInvestingData($params, $this->getUserInfo());

        if (!empty($data['message'])) {
            return Common::fail($data['message']);
        }
        return Common::success($data);
    }

    // 渲染百度今日实时在投列表页
    public function baiduRealTime()
    {
        return view();
    }

    // 百度今日实时在投
    public function baiduInvesting()
    {
        $params = Request::param();
        $data = $this->service->getBaiduInvestingData($params, $this->getUserInfo());

        if (!empty($data['message'])) {
            return Common::fail($data['message']);
        }
        return Common::success($data);
    }

    // 渲染腾讯今日实时在投列表页
    public function tencentRealTime()
    {
        return view();
    }

    // 腾讯今日实时在投
    public function tencentInvesting()
    {
        $params = Request::param();
        $data = $this->service->getTencentInvestingData($params, $this->getUserInfo());

        if (!empty($data['message'])) {
            return Common::fail($data['message']);
        }
        return Common::success($data);
    }

    // 渲染按短剧统计页面
    public function byVideo()
    {
        return view();
    }

    // 获取按短剧统计数据
    public function byShortPlay()
    {
        $params = Request::param();
        $data = $this->service->getByShortPlayList($params);
        return Common::success($data);
    }

    // by add huangxiaoshan 2023-07-21
    // 渲染按短剧95折扣统计数据
    public function byVideoDiscount()
    {
        return view();
    }

    // 按短剧统计合计
    public function byShortPlayCount()
    {
        $params = Request::param();
        $data = $this->service->getByShortPlayCount($params);
        return Common::success($data);
    }

    // 渲染查看每个负责人统计详细列表页
    public function peopleInfo()
    {
        return view();
    }

    // 每个负责人统计详细
    public function peopleDetail()
    {
        $params = Request::param();
        $data = $this->service->getPeopleDetail($params);
        return Common::success($data);
    }

    // 按负责人统计列表页
    public function byPeopleIndex()
    {
        return view();
    }

    // 按负责人统计
    public function byPeopleList()
    {
        $params = Request::param();
        $data = $this->service->getByPeopleList($params, $this->getUserInfo());
        return Common::success($data);
    }

    // 获取指定负责人指定月份数据
    public function getPeopleList()
    {
        $params = Request::param();
        $data = $this->service->getPeopleListByMonth($params);
        return Common::success($data);
    }

    // 获取指定负责人指定月份数据合计
    public function getPeopleListCount()
    {
        $params = Request::param();
        $data = $this->service->getPeopleListByMonthCount($params);
        return Common::success($data);
    }

    // 每个负责人按月份合计
    public function peopleDetailCount()
    {
        $params = Request::param();
        $data = $this->service->getPeopleDetailCount($params);
        return Common::success($data);
    }
}